LEGO Drum Machine
Dexter Industries recently updated their BrickPi product line to the BrickPi3 for
connecting Mindstorms sensors and motors to a Raspberry Pi. An update in the BrickPi3 is its
motor feedback speed, which can be applied to interesting new robotics applications. There’s
a video on dexterindustries.com for a BalanceBot, taking advantage of the high speed of the
BrickPi3 to build a two-wheeled robot that keeps its balance by rapid update to each of the
two motors via data from a Gyro Sensor. Aside from motor update speed, the BrickPi 3 seemed
to me to be rather fast in running lines of code in a Python program. This got me to thinking
about audio and musical applications of Mindstorms that can’t really be done well on the EV3
Intelligent Brick. The EV3 Intelligent Brick does have a speaker built in that is useful for
basic sound function, but the audio quality is poor. There is no headphone jack output on
the EV3 Intelligent Brick and sound samples are limited to 8-seconds in length in the EV3
programming environment. Use of a Raspberry Pi in place of the EV3 Intelligent Brick solves
many of these problems to work with sound and music. I’ve had trouble with the headphone
output jack on the Raspberry Pi and so switched to a USB audio output. USB audio adapters,
which also include a microphone input, are inexpensively available on Amazon.
My first project in audio is shown in the video above to build a drum machine from
Mindstorms/Raspberry Pi/BrickPi3. And I threw in a GrovePi, since I only had two Mindstorms Touch
Sensors. I wanted three touch sensors, so I used a Grove Button that I had on hand. And since the
GrovePi was in the setup, I added LEDs. I downloaded samples of drum sounds from freewavesamples.com,
using in the program above a sample of a snare, hi-hat cymbal, and a crash cymbal. Pressing
one of the three touch sensors, triggers one of the wav file samples.